(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['views/base/view'], function() {
    var BaaseView, ModalView, _ref;
    BaaseView = require('views/base/view');
    return ModalView = (function(_super) {
      __extends(ModalView, _super);

      function ModalView() {
        _ref = ModalView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      ModalView.prototype.autoRender = true;

      ModalView.prototype.className = 'modal fade';

      ModalView.prototype.attributes = {
        'tabindex': -1,
        'role': 'dialog',
        'data-backdrop': 'static',
        'data-keyboard': 'false'
      };

      ModalView.prototype.modalTitle = 'Título';

      ModalView.prototype.closeLabel = 'Fechar';

      ModalView.prototype.submitLabel = 'Salvar';

      ModalView.prototype.showFooter = true;

      ModalView.prototype.showSubmitButton = true;

      ModalView.prototype.submitId = 'modal-submit-button';

      ModalView.prototype.template = "<div class=\"modal-dialog\">\n  <div class=\"modal-content\">\n    <div class=\"modal-header\">\n      <h3 id=\"modal-title\">{{modalTitle}}</h3>\n    </div>\n\n    <div class=\"modal-body\">{{html bodyTemplate bodyArguments}}</div>\n\n    {{#if showFooter}}\n      <div class=\"modal-footer\">\n        <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">{{closeLabel}}</button>\n        {{#if ../showSubmitButton}}\n          <a class=\"btn btn-primary\" id=\"{{submitId}}\">{{submitLabel}}</a>\n        {{/if}}\n      </div>\n    {{/if}}\n  </div>\n</div>";

      ModalView.prototype.bodyTemplate = 'Body template';

      ModalView.prototype.getTemplateData = function() {
        return _.extend(ModalView.__super__.getTemplateData.apply(this, arguments), {
          modalTitle: this.modalTitle,
          closeLabel: this.closeLabel,
          submitLabel: this.submitLabel,
          submitId: this.submitId,
          bodyTemplate: this.bodyTemplate,
          showFooter: this.showFooter,
          showSubmitButton: this.showSubmitButton,
          bodyArguments: {}
        });
      };

      ModalView.prototype.afterRender = function() {
        return ModalView.__super__.afterRender.apply(this, arguments);
      };

      ModalView.prototype.cacheDOMElements = function() {
        return this.DOMElements = {
          $modalHeader: this.$el.find('.modal-header'),
          $modalBody: this.$el.find('.modal-body'),
          $modalFooter: this.$el.find('.modal-footer'),
          $submitButton: this.$el.find('#' + this.submitId)
        };
      };

      ModalView.prototype.show = function() {
        this.$el.modal({
          show: true,
          backdrop: 'static',
          keyboard: false
        });
        return this.trigger('modal:show');
      };

      ModalView.prototype.hide = function() {
        this.$el.modal('hide');
        this.trigger('modal:hide');
        return $('.tooltip').remove();
      };

      ModalView.prototype.clickSubmitButtonHandler = function(event) {
        return event.preventDefault();
      };

      return ModalView;

    })(BaaseView);
  });

}).call(this);
